<?php
$this->breadcrumbs=array(
	'Machines'=>array('index'),
);

$this->menu=array(
	array('label'=>'机器管理', 'url'=>array('admin')),
	array('label'=>'添加机器', 'url'=>array('create')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('machine-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1>机器列表</h1>


<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'machine-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
		'id',
		'hostname',
		//'aliasname',
		//'ip',
		array(
            'name' => 'conn',
            'value' => '$data->conn==1?"OK":"Lost"',
        ),
		array(
            'name' => 'workgroup',
            'value' => 'CActiveRecord::model(\'Workgroup\')->find(\'id=\'.$data->workgroup)->groupname',
        ),
        //'workgroup',
		array(
            'name' => 'isentity',
            'value' => '$data->isentity==1?"实体机":"虚拟机"',
        ),
		array(
            'name' => 'handle',
            'value' => 'CActiveRecord::model(\'Handle\')->find(\'id=\'.$data->handle)->handlename',
        ),
		'cpu',
        'mem',
        'disk',
        'network',
        'os',
		'remark',
		//'status',
		/*
		'flag',
		'conn',
		'workgroup',
		'director',
		'system',
		'cpu',
		'mem',
		'disk',
		'network',
		'os',
		'isentity',
		'handle',
		*/
        array(
            'class' => 'CButtonColumn',
            'header' => '详情',
            'template' => '{view}',
        ),
	),
)); ?>
